#ifndef DODO_PLAYNOTE_H
#define DODO_PLAYNOTE_H

void PlayNote(int note, int key_num, int key_status[])
{
	if(note >= 1 && note <= key_num)
		key_status[note] = 127;
}

void StopNote(int note, int key_num, int key_status[])
{
	if(note >= 1 && note <= key_num)
		key_status[note] = 0;
}

void CalculateWheelV(int key_num, int key_status[], int* key2wheel,
	int wheel_num, double wheel_v[],
	int drawbar_num, int drawbar[], double drawbar_level[])
{
	int i, j;
	double *new_v = (double*) malloc ((wheel_num+1)*sizeof(double));

	for( i = 1; i <= wheel_num; ++i)
		new_v[i] = 0.0;

	for( i = 1; i <= key_num; ++i)
	{
		for( j = 0; j < drawbar_num; ++j)
		{
			new_v[ *(key2wheel+i*drawbar_num+j) ] += (key_status[i] / 127.0) *drawbar_level[ drawbar[j] ] ;
		}
	}

	for( i = 1; i <= wheel_num; ++i)
		wheel_v[i] = new_v[i];
	free(new_v);
}
#endif

